#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<windows.h>
#include<stdlib.h>
int main() {
    int n = 0;
    int i = 0;
    int j = 0;
    int k = 2;
    int count = 0;
    int a[100] = { 0 };
    while (scanf("%d", &n) != EOF) {
        for (i = 2; i <= n; i++) {
            a[i] = i;
        }
        for (i = 2; i <= n/2; i++) {
            while ((i * k) <= n) {
                if (a[i * k] != 0)count++;
                a[i* k] = 0;
                k++;
            }
            k = 2;
        }
        for (i = 3; i <= n; i++) {
            if (a[i] != 0)printf("%d  ", a[i]);
        }
        printf("\n");
        printf("%d\n", count);
    }
  
    
    return 0;
}